//
//  ZTFooterView.m
//  CarTown
//
//  Created by xionghao on 15/9/19.
//  Copyright © 2015年 熊浩. All rights reserved.
//

#import "ZTFooterView.h"
#import "ZCDetailMode.h"
@interface ZTFooterView ()
@property (weak, nonatomic) IBOutlet UIImageView *typeicon;
@property (weak, nonatomic) IBOutlet UILabel *phone;
@property (weak, nonatomic) IBOutlet UILabel *name;
@property (weak, nonatomic) IBOutlet UILabel *address;
@property (weak, nonatomic) IBOutlet UILabel *contname;
@property (nonatomic,strong)ZCDetailMode *mode;
@end

@implementation ZTFooterView
+(instancetype)footerWith:(ZCDetailMode *)mode{
    ZTFooterView *footer=[[[NSBundle mainBundle]loadNibNamed:NSStringFromClass([self class]) owner:nil options:nil]lastObject];
    footer.mode=mode;
    return footer;
}

-(void)setMode:(ZCDetailMode *)mode{
    _mode=mode;
    self.width=XHScreenwidth;
    self.name.text=mode.com_name;
    if ([mode.user_company_address isEqualToString:@""]||mode.user_company_address==nil) {
         self.address.text=@"暂未填写";
    }else{
         self.address.text=mode.user_company_address;
    }
    self.contname.text=_mode.user_truename;
    self.phone.text=_mode.user_mobile;
    
    
    
    switch ([_mode.msn integerValue]) {
        case GANGKOU:
            self.typeicon.image=[UIImage imageNamed:@"ico_hk"];
            break;
        case FOURS:
            self.typeicon.image=[UIImage imageNamed:@"ico_4s"];
            break;
        case PERSONAL:
            self.typeicon.image=[UIImage imageNamed:@"ico_p"];
            
            break;
        case ZIYUAN:
            self.typeicon.image=[UIImage imageNamed:@"ico_z"];
            break;
        case ZONGHE:
            self.typeicon.image=[UIImage imageNamed:@"ico_zonghe"];
            break;
        default:
            break;
    }

    self.height=CGRectGetMaxY(self.phone.frame)+16;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
